next up previous
Next: 5.2 Reliability Assurances Up: 5 Multi-rendering Implementation Previous: 5 Multi-rendering Implementation

5.1 Example of Execution

  
Figure 4: Simplified diagram showing the synchronization points for an X client rendering OpenGL through the X server using multi-rendering. Solid lines represent flow of control; dashed lines indicate where one thread resumes another.

Figure 4 shows the synchronization that takes place between a client, the X server, and a rendering thread when an OpenGL rendering request is executed.

  1. An OpenGL client sends a GLX extension request, which contains a batch of OpenGL commands.

  2. The X server receives the request and dispatches it to the GLX extension.

  3. The request is handed over to the client's rendering thread. Request input from this client is suspended by calling IgnoreClient.

  4. The rendering thread wakes up to receive the request.

  5. The rendering thread decodes the batch of commands in the request, issuing a call to the OpenGL rendering library for each command. The rendering library attempts to access the graphics hardware pages.

  6. Assuming an invalid RRM resource for the rendering node, the page access causes a fault, and the kernel sends an RRM message to the X server for resource validation.

  7. The X server receives and dispatches the RRM message.

  8. Resources are validated and a response is sent to the kernel.

  9. The kernel remaps the graphics hardware pages and resumes execution of the rendering thread.

  10. The rendering thread announces that it has completed the rendering request by releasing the polling semaphore.

  11. The semaphore release causes the X server to wake up from select. A wakeup handler notices that the OpenGL thread has finished rendering, and resumes request input from the client by calling AttendClient.

  12. Returned data, if any, is sent to the client.

Steps 6 through 9 demonstrate the handling of an invalid RRM resource. In this case, the operating system has unmapped the renderer's graphics pipe due to some invalid RRM resource. The X server's main thread and kernel conspire to validate the invalid resource transparently. This is not the common case but does happen when the window's drawable clip changes or the rendering node is requesting a buffer swap and the window does not have an unshared display ID. It is possible for multiple RRM resource validations to occur during a rendering thread's execution.

Note that in Figure 4, there is only a single point where the main X server thread blocks. This allows the main X server thread to avoid deadlock when it is both waiting for a rendering thread request to complete and handling RRM resource validation requests for blocked rendering threads.



next up previous
Next: 5.2 Reliability Assurances Up: 5 Multi-rendering Implementation Previous: 5 Multi-rendering Implementation



Mark Kilgard
Sun Jan 7 19:20:04 PST 1996